| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Static Public Member Functions | List of all members
nkGraphics::TextureUtils Class Referencefinal

Utility class to retrieve or compute interesting data about textures. More...

## Static Public Member Functions
static unsigned int | getFormatByteSize (FORMAT format)
static unsigned int | getFormatChannelCount (FORMAT format)
static unsigned int | getFormatPlaneCount (FORMAT format)
static FORMAT | getFormatSrgbEquivalent (FORMAT format)
static FORMAT | getFormatRgbEquivalent (FORMAT format)
static FORMAT | getFormatTypelessEquivalent (FORMAT format)
static FORMAT | getFormatDepthEquivalent (FORMAT format)
static FORMAT | getFormatUncompressedEquivalent (FORMAT format)
static FORMAT | getFormatWithAlphaEquivalent (FORMAT format)
static bool | isFormatOver255 (FORMAT format)
static bool | isFormatCompressed (FORMAT format)
static bool | isFormatCompatibleWithStencil (FORMAT format)
static bool | isFormatCompatibleForRenderFlag (FORMAT format, TEXTURE_RENDER_FLAG renderFlag, BUFFER_BIND_FLAG bindFlag)
static int | getNeededMipsForSize (int width, int height, int depthOrArraySize, bool texArray)
static FORMAT | getFormatFromImageFormat (nkImages::PIXEL_FORMAT format)

## Detailed Description

Utility class to retrieve or compute interesting data about textures.

## Member Function Documentation

## ◆ getFormatByteSize()

static unsigned int nkGraphics::TextureUtils::getFormatByteSize | ( | FORMAT | format | ) |
| static

Parameters

  format | The format to use.

Returns
  The size, in bytes, of one element of the format passed.

## ◆ getFormatChannelCount()

static unsigned int nkGraphics::TextureUtils::getFormatChannelCount | ( | FORMAT | format | ) |
| static

Parameters

  format | The format to use.

Returns
  The number of channels (r, g, b, a) used by the format passed.

## ◆ getFormatPlaneCount()

static unsigned int nkGraphics::TextureUtils::getFormatPlaneCount | ( | FORMAT | format | ) |
| static

Parameters

  format | The format to use.

Returns
  The number of planes the format passed has.

## ◆ getFormatSrgbEquivalent()

static FORMAT nkGraphics::TextureUtils::getFormatSrgbEquivalent | ( | FORMAT | format | ) |
| static

Parameters

  format | The format to use.

Returns
  The srgb equivalent format of the format passed, if available. The format passed if unavailable.

## ◆ getFormatRgbEquivalent()

static FORMAT nkGraphics::TextureUtils::getFormatRgbEquivalent | ( | FORMAT | format | ) |
| static

Parameters

  format | The format to use.

Returns
  The rgb equivalent format of the format passed, if available. The format passed if unavailable.

## ◆ getFormatTypelessEquivalent()

static FORMAT nkGraphics::TextureUtils::getFormatTypelessEquivalent | ( | FORMAT | format | ) |
| static

Parameters

  format | The format to use.

Returns
  The typeless equivalent format of the format passed, if available. The format passed if unavailable.

## ◆ getFormatDepthEquivalent()

static FORMAT nkGraphics::TextureUtils::getFormatDepthEquivalent | ( | FORMAT | format | ) |
| static

Parameters

  format | The format to use.

Returns
  The depth equivalent format of the format passed, if available. The format passed if unavailable.

## ◆ getFormatUncompressedEquivalent()

static FORMAT nkGraphics::TextureUtils::getFormatUncompressedEquivalent | ( | FORMAT | format | ) |
| static

Parameters

  format | The format to use.

Returns
  The uncompressed equivalent format of the format passed, if available. The format passed if unavailable.

## ◆ getFormatWithAlphaEquivalent()

static FORMAT nkGraphics::TextureUtils::getFormatWithAlphaEquivalent | ( | FORMAT | format | ) |
| static

Parameters

  format | The format to use.

Returns
  The equivalent format of the format passed, with the alpha channel added to it if available. The format passed if unavailable.

## ◆ isFormatOver255()

static bool nkGraphics::TextureUtils::isFormatOver255 | ( | FORMAT | format | ) |
| static

Parameters

  format | The format to use.

Returns
  If the format values should be considered in [0, 255] (true) or, rather, between [0.0, 1.0] (false).

## ◆ isFormatCompressed()

static bool nkGraphics::TextureUtils::isFormatCompressed | ( | FORMAT | format | ) |
| static

Checks whether a format is compressed. Compressed formats are usually variants of BC and such.

Parameters

  format | The format to use.

Returns
  If the format is compressed (true) or not (false).

## ◆ isFormatCompatibleWithStencil()

static bool nkGraphics::TextureUtils::isFormatCompatibleWithStencil | ( | FORMAT | format | ) |
| static

Checks whether a format is compatible for stencil rendering.

Parameters

  format | The format to use.

Returns
  Whether the format is compatible for stencil rendering (true) or not (false).

## ◆ isFormatCompatibleForRenderFlag()

static bool nkGraphics::TextureUtils::isFormatCompatibleForRenderFlag | ( | FORMAT | format,
|  | TEXTURE_RENDER_FLAG | renderFlag,
|  | BUFFER_BIND_FLAG | bindFlag
| ) |  |
| static

Parameters

  format | The format to use.
  renderFlag | The render flag to check against.
  bindFlag | The binding flag forecast for the texture to use.

Returns
  If the format is compatible to use with given render flag and bind flag.

## ◆ getNeededMipsForSize()

static int nkGraphics::TextureUtils::getNeededMipsForSize | ( | int | width,
|  | int | height,
|  | int | depthOrArraySize,
|  | bool | texArray
| ) |  |
| static

Parameters

  width | The width of the texture.
  height | The height of the texture.
  depthOrArraySize | The depth, or array size, of the texture.
  texArray | Whether the texture is supposed to be an array (true) or not (false).

Returns
  The number of mips needed to generate a full mip chain for the dimensions given.

## ◆ getFormatFromImageFormat()

static FORMAT nkGraphics::TextureUtils::getFormatFromImageFormat | ( | nkImages::PIXEL_FORMAT | format | ) |
| static

Parameters

  format | The nkImages format to convert.

Returns
  The associated nkGraphics format.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsGraphics/Textures/TextureUtils.h